package com.sali;

import com.sali.netty.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.concurrent.ExecutorService;

@SpringBootApplication
public class SaliMockFriendApplication {

    @Resource(name = "commonExecutor")
    private ExecutorService executorService;

    @Autowired
    private NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(SaliMockFriendApplication.class, args);
    }


    @PostConstruct
    public void init() {
        executorService.execute(() -> nettyServer.start());
    }
}
